Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
aria-hidden
Advanced tools
Hides from ARIA everything, except provided node(s).
Helps to isolate modal dialogs and focused task - the content will be not accessible using accessible tools.
Now with HTML inert support
Just call hideOthers
with DOM-node you want to keep, and it will hide everything else.
targetNode
could be placed anywhere - its siblings would be hidden, but it and its parents - not.
"hidden" in terms or
aria-hidden
import { hideOthers } from 'aria-hidden';
const undo = hideOthers(exceptThisDOMnode);
// everything else is "aria-hidden"
// undo changes
undo();
you also may limit the effect spread by providing top level node as a second parameter
// keep only `anotherNode` node visible in #app
// the rest of document will be untouched
hideOthers(anotherNode, document.getElementById('app'));
parentNode
defaults to document.body
While aria-hidden
played important role in the past and will play in the future - the main
use case always was around isolating content and making elements "transparent" not only for aria, but for
user interaction as well.
This is why you might consider using inertOthers
import { hideOthers, inertOthers, supportsInert } from 'aria-hidden';
// focus on element mean "hide others". Ideally disable interactions
const focusOnElement = (node) => (supportsInert() ? inertOthers(node) : hideOthers(node));
the same function as above is already contructed and exported as
import { suppressOthers } from 'aria-hidden';
suppressOthers([keepThisNode, andThis]);
⚠️ Note - inert will disable any interactions with suppressed elements ⚠️
One can marker
, the third argument to a function, to mark hidden elements.
Later one can create a style matching given marker to apply pointer-events:none
[hidden-node] {
pointer-events: none;
}
hideOthers(notThisOne, undefined /*parent = document*/, 'hidden-node');
Generally speaking the same can be achieved by addressing [aria-hidden]
nodes, but
not all aria-hidden
nodes are expected to be non-interactive.
Hence, it's better to separate concerns.
Based on smooth-ui modal dialogs.
Code is 30 lines long
MIT
FAQs
Cast aria-hidden to everything, except...
The npm package aria-hidden receives a total of 3,825,174 weekly downloads. As such, aria-hidden popularity was classified as popular.
We found that aria-hidden demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.